#include <stdio.h>

int main() {
	int m = 0;
	int n = 0;
	scanf("%d %d", &m, &n);
	int arr[100][100] = {0};
	int num = 1;
	int top = 0;
	int bottom = m - 1;
	int left = 0;
	int right = n - 1;
	while (top <= bottom && left <= right) {
		int i = 0;
		int j = 0;
		for ( i = left; i <= right; i++) {
			arr[top][i] = num++;
			if (num == (m * n) + 1)
				break;
		}
		if (num == (m * n) + 1)
			break;
		top++;
		for (j = top; j <= bottom; j++) {
			arr[j][right] = num++;
			if (num == (m * n) + 1)
				break;
		}
		if (num == (m * n) + 1)
			break;
		right--;
		for ( i = right; i >= left; i--) {
			arr[bottom][i] = num++;
			if (num == (m * n) + 1)
				break;
		}
		if (num == (m * n) + 1)
			break;
		bottom--;


		for (i = bottom; i >= top; i--) {
			arr[i][left] = num++;
			if (num == (m * n) + 1)
				break;
		}
		if (num == (m * n) + 1)
			break;
		left++;



	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			printf("%d ", arr[i][j]);
		}
		printf("\n");
	}


	return 0;
}